package com.niubi.yygh.cmn.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.niubi.yygh.cmn.mapper.DictMapper;
import com.niubi.yygh.model.cmn.Dict;
import com.niubi.yygh.vo.cmn.DictEeVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DictListener extends AnalysisEventListener<DictEeVo> {

  @Autowired
  DictMapper dictMapper;

  @Override
  public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
    Dict dict = new Dict();
    BeanUtils.copyProperties(dictEeVo,dict);
    dictMapper.insert(dict);
  }

  @Override
  public void doAfterAllAnalysed(AnalysisContext analysisContext) {

  }
}